<?php
    namespace App\common;
    
	/* developer	: BREEZEER
	 * date			: 2022/6/23
	 * description	: combine permission bits for read write modify delete
	 *
	 *
	 *
	 *
	 *
	 *
	 */
    interface iPermission 
	{
		
		/* permission bit => [ 32位长度的权限值，每一个比特位置0|1都是开关， 0禁用 1启用，1=read 2=write 4=modify 8=delete ，权限位可以或与操作 ]
		 *
		 */
		public const PERMISSION_READ	= 1						;	# read
		public const PERMISSION_WRITE	= 2						;	# write
		public const PERMISSION_MODIFY	= 4						;	# modify
		public const PERMISSION_DELETE	= 8						;	# delete

		/*
		 *
		 */
        public function canRead		($ar_read	)				;
        public function canWrite	($ar_write	)				;
        public function canModify	($ar_modfiy )				;
        public function canDelete	($ar_delete	)				;
	}
	class cPermissionAuthCode
	{
		public function getAllPermissionAuthCode()
		{
			$ar			= [];
			foreach(((new \ReflectionClass($this::class))->getConstants()) as $one_permisssion)
			{	
				$ar[]	= $one_permisssion;
			}
			return $ar;
		}

		/* 信用项目权限列表
		 *
		 */
		public const AUTH_CODE_CREDIT_PROJECT																		=	'AUTH_CODE_CREDIT_PROJECT'													;	# 信用项目
		public const AUTH_CODE_CREDIT_PROJECT_CONFIRM_CURRENT_CREDIT_PROJECT_LIST									=	'AUTH_CODE_CREDIT_PROJECT_CONFIRM_CURRENT_CREDIT_PROJECT_LIST'				;	# 信用项目确认事项
		public const AUTH_CODE_CREDIT_PROJECT_CONFIRM_FINANCE_INFORMATION											=	'AUTH_CODE_CREDIT_PROJECT_CONFIRM_FINANCE_INFORMATION'						;	# 信用项目财务信息

        /*
         * 客户权限
         */
        // 客户管理
        const AUTH_CODE_CLIENT = 'AUTH_CODE_CLIENT';
        // 信用客户管理
        const AUTH_CODE_CREDIT_CLIENT = 'AUTH_CODE_CREDIT_CLIENT';
        // 信控
        const AUTH_CLIENT_XK = 'AUTH_CLIENT_XK';
        // 法务审批
        const AUTH_CODE_CONTRACT_LAW = 'AUTH_CODE_CONTRACT_LAW';

		/*
		 * 合同权限
		 */

        const AUTH_CODE_CONTRACT = 'CONTRACT_AUTH';
	}
